package applications.libraryForm.ui.lib;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.util.Observable;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SpringLayout;
import javax.swing.SwingConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;

import ontocompo.lib.SpringUtilities;

import org.objectweb.fractal.fraclet.annotations.Component;
import org.objectweb.fractal.fraclet.annotations.Interface;
import org.objectweb.fractal.fraclet.annotations.Requires;

import applications.libraryForm.fc.api.LibraryForm;

@Component(provides = {@Interface(name = "jPanelItf", signature = org.objectweb.fractal.swing.JPanelItf.class), @Interface(name = "observer", signature = java.util.Observer.class), @Interface(name = "jPanelAttributes", signature = org.objectweb.fractal.swing.JPanelAttributes.class), @Interface(name = "uicontainerservice", signature = ontocompo.api.UIContainerService.class), @Interface(name = "ontocompointrospection", signature = ontocompo.api.OntoCompoIntrospection.class)})


public class LibraryFormStudentSummaryButton extends JPanel implements  java.util.Observer, org.objectweb.fractal.swing.JPanelItf, org.objectweb.fractal.swing.JPanelAttributes, ontocompo.api.UIContainerService, ontocompo.api.OntoCompoIntrospection {

	private String uid;
	private org.objectweb.fractal.api.Component c;


	@Requires(name = "libraryFormReturnedBooksPanel")
	private ontocompo.api.UIContainerService libraryFormReturnedBooksPanel;
	
	@Requires(name = "libraryFormNonReturnedBooksPanel")
	private ontocompo.api.UIContainerService libraryFormNonReturnedBooksPanel;




	@Requires(name = "libraryformdirectoryservice")
	private applications.libraryForm.fc.api.LibraryFormDirectoryService libraryformdirectoryservice;

	@Requires(name = "libraryformdirectoryobservable")
	private ontocompo.api.Observable libraryformdirectoryobservable;


	public LibraryFormStudentSummaryButton() {
		super();
		this.uid = "applications.libraryForm.ui.lib.LibraryFormStudentSummaryButton";
		System.out.println(this.toString() + "   created!");

	}



	@Override
	public JComponent getComponentItSelf() {
		// TODO Auto-generated method stub
		return this;
	}



	@Override
	public void init() {


		this.libraryformdirectoryobservable.addObserver(this);

		JPanel panel1 = new JPanel(new BorderLayout());
		JPanel panel2 = new JPanel(new BorderLayout());

		
		this.libraryFormReturnedBooksPanel.init();
		this.libraryFormNonReturnedBooksPanel.init();
		
		this.setBackground(Color.white);
		panel1.setBackground(Color.white);
		panel2.setBackground(Color.white);

		


		panel1.add(this.libraryFormReturnedBooksPanel.getComponentItSelf(), BorderLayout.NORTH);
		panel2.add(this.libraryFormNonReturnedBooksPanel.getComponentItSelf(),BorderLayout.CENTER);

		
		this.add(panel1, BorderLayout.NORTH);
		this.add(panel2, BorderLayout.CENTER);

		



	}

	protected JLabel createTd(String txt)
	{
		JLabel result = new JLabel(txt);
		result.setFont(result.getFont().deriveFont(Font.PLAIN));
		result.setHorizontalAlignment(SwingConstants.LEFT);

		return result;
	}
	public String toString() {

		return "LibraryFormStudentSummaryButton";
	}


	protected JPanel createBox(int thickness)
	{
		JPanel result = new JPanel();
		if (thickness > 0) result.setBorder(BorderFactory.createLineBorder(Color.black, thickness));
		result.setBackground(Color.white);
		return result;
	}


	@Override
	public void update(Object o) {}


	@Override
	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub

		LibraryForm bkk = this.libraryformdirectoryservice.getLibraryForm();

		if (bkk == null){
			return;
		}
		else { 
			this.update(bkk);
		}


	}


	@Override
	public org.objectweb.fractal.api.Component getFractalComponent() {
		// TODO Auto-generated method stub
		return this.c;
	}

	@Override
	public String getUid() {
		// TODO Auto-generated method stub
		return this.uid;
	}

	@Override
	public void setFractalComponent(org.objectweb.fractal.api.Component c) {
		// TODO Auto-generated method stub
		this.c = c;
	}

	@Override
	public void setUid(String uid) {
		// TODO Auto-generated method stub

	}


}
